import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
import get from '@dfeidao/atom-mobile/local/get';
import set from '@dfeidao/atom-mobile/local/set';
import show_sheet from '@dfeidao/atom-mobile/msgbox/action-sheet';
import render from '@dfeidao/atom-mobile/render/render';
export default async function a004(fd: IFeidaoAiMobile) {
	// 年级
	const grade = get(fd, 'grade') as [{ grade: string, grade_no: string }];
	const options = new Array();
	for (let i = 0; i < grade.length; i++) {
		const text = grade[i].grade;
		options.push(text);
	}
	options.push('取消');
	const res = await show_sheet({
		options,
		title: '选择年级'
	});
	const class_s = grade[res];
	if (class_s) {
		const grade_no = class_s.grade_no;
		const grade_name = class_s.grade;
		set(fd, 'grade_no', grade_no);
		set(fd, 'grade_name', grade_name);
		render(fd, { grade_name, grade_no, class_name: '', data: [] });
	}
}
